package com.yanfan.energy.mapper;

import com.yanfan.energy.domain.Energyynlx;
import com.yanfan.energy.domain.statist.CompanyBuildArea;
import com.yanfan.energy.domain.statist.DateByStatistics;
import com.yanfan.energy.domain.statist.DatePlusStatistics;
import com.yanfan.iot.domain.Device;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.time.LocalDate;
import java.util.List;

/**
 * 设备Mapper接口
 *
 * @author kerwincui
 * @date 2021-12-16
 */
@Repository
public interface DeviceEnergyMapper {

    /**
     * 四种电统计（电的能耗kw/h）
     *
     * @param datetime
     * @param workshopId
     * @param buildingId
     * @param energyId
     * @param begin
     * @param end
     * @return java.util.List<com.ruoyi.common.core.domain.model.DateByStatistics>
     * @author caijinkang
     * @date 2023/2/21 14:49
     */
    List<DateByStatistics> findConsumeElectricity(@Param("datetime") String datetime, @Param("workshopId") Integer workshopId, @Param("floorId") Integer floorId, @Param("buildingId") Integer buildingId, @Param("energyId") Integer energyId, @Param("begin") LocalDate begin, @Param("end") LocalDate end);

    /**
     * 四种电去计算单价和用电的费用(查询年表的数据)
     *
     * @param datetime
     * @param workshopId
     * @param energyId
     * @param begin
     * @param end
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateByStatistics>
     * @author caijinkang
     * @date 2022/11/4 10:30
     */
    List<DateByStatistics> findConsumeElectricityPriceByYear(@Param("datetime") String datetime, @Param("workshopId") Integer workshopId, @Param("floorId") Integer floorId, @Param("buildingId") Integer buildingId, @Param("energyId") Integer energyId, @Param("begin") LocalDate begin, @Param("end") LocalDate end);

    /**
     * 四种电去计算单价和用电的费用
     *
     * @param datetime
     * @param workshopId
     * @param energyId
     * @param begin
     * @param end
     * @return java.util.List<io.github.jhipster.sample.sansheng.tool.statistics.DateByStatistics>
     * @author caijinkang
     * @date 2022/11/4 10:30
     */
    List<DateByStatistics> findConsumeElectricityPrice(@Param("datetime") String datetime, @Param("workshopId") Integer workshopId, @Param("floorId") Integer floorId, @Param("buildingId") Integer buildingId, @Param("energyId") Integer energyId, @Param("begin") LocalDate begin, @Param("end") LocalDate end);

    /**
     * 四种电统计（电的能耗kw/h），加入了设备条件
     *
     * @param datetime
     * @param workshopId
     * @param buildingId
     * @param deviceId
     * @param userId
     * @param tenantId
     * @param energyId
     * @param begin
     * @param end
     * @return java.util.List<com.ruoyi.common.core.domain.model.DateByStatistics>
     * @author caijinkang
     * @date 2023/3/24 16:02
     */
    List<DateByStatistics> findConsumeElectricityAndDevice(@Param("datetime") String datetime, @Param("workshopId") Integer workshopId, @Param("buildingId") Integer buildingId, @Param("deviceId") Integer deviceId, @Param("userId") Integer userId, @Param("tenantId") Integer tenantId, @Param("energyId") Integer energyId, @Param("begin") LocalDate begin, @Param("end") LocalDate end);

    /**
     * 四种电去计算单价和用电的费用，加入了设备条件
     *
     * @param datetime
     * @param workshopId
     * @param buildingId
     * @param deviceId
     * @param userId
     * @param tenantId
     * @param energyId
     * @param begin
     * @param end
     * @return java.util.List<com.ruoyi.common.core.domain.model.DateByStatistics>
     * @author caijinkang
     * @date 2023/3/24 15:53
     */
    List<DateByStatistics> findConsumeElectricityPriceAndDevice(@Param("datetime") String datetime, @Param("workshopId") Integer workshopId, @Param("buildingId") Integer buildingId, @Param("deviceId") Integer deviceId, @Param("userId") Integer userId, @Param("tenantId") Integer tenantId, @Param("energyId") Integer energyId, @Param("begin") LocalDate begin, @Param("end") LocalDate end);


    /**
     * 查询设备的能耗实际电费费用
     *
     * @param deviceName
     * @param deviceId
     * @param buildingId
     * @param floorId
     * @param workshopId
     * @param beginDate
     * @param endDate
     * @param symbol
     * @param format
     * @return java.util.List<com.ruoyi.common.core.domain.model.DatePlusStatistics>
     * @author caijinkang
     * @date 2023/5/11 14:58
     */
    List<DatePlusStatistics> findSaveDeviceAmount(@Param("deviceName") String deviceName, @Param("deviceId") Integer deviceId, @Param("buildingId") Integer buildingId, @Param("floorId") Integer floorId, @Param("workshopId") Integer workshopId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("symbol") String symbol, @Param("format") String format);

    /**
     * 查询设备对应的能耗产生的耗能
     *
     * @param deviceName
     * @param deviceId
     * @param buildingId
     * @param floorId
     * @param workshopId
     * @param beginDate
     * @param endDate
     * @param symbol
     * @param format
     * @return java.util.List<com.ruoyi.common.core.domain.model.DatePlusStatistics>
     * @author caijinkang
     * @date 2023/5/11 14:58
     */
    List<DatePlusStatistics> findSaveDeviceEnergy(@Param("deviceName") String deviceName, @Param("deviceId") Integer deviceId, @Param("buildingId") Integer buildingId, @Param("floorId") Integer floorId, @Param("workshopId") Integer workshopId, @Param("beginDate") String beginDate, @Param("endDate") String endDate, @Param("symbol") String symbol, @Param("format") String format);

    List<Energyynlx> getcompany(Long companId);

    List<Energyynlx> getbuilding(@Param("companId") Long companId, @Param("buildingId") Long buildingId);

    List<Energyynlx> getfloor(@Param("companId") Long companId, @Param("buildingId") Long buildingId);

    List<Energyynlx> getworkshop(@Param("companId") Long companId, @Param("buildingId") Long buildingId);

    List<Energyynlx> getcompanylist();
}
